package lab02.test21;

import java.util.Scanner;

public class Test21 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个字符串：");
        String a = sc.next();
        int j = 0;
        double x;

        //指定字符t
        char[] arr = a.toCharArray();
        for (int i = 0;i < a.length() ;i ++) {
            if (arr[i] == 't')j ++;
        }

        //t出现的频率
        System.out.print("字符t出现的频率是：");
        System.out.println(x = (j*1.0/(a.length())));
    }
}
